#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution {
public:
	string reverseWords(string s) {
		int left=0, right = 0;
		while (right <= s.length()) {
			if (s[right] == ' '||right==s.length()) {
				for (int r = right - 1; left < r; left++, r--) {
					char temp = s[left];
					s[left] = s[r];
					s[r] = temp;
				}
				left = right+1;
			}
			right++;
		}
		return s;
	}
};

void main() {
	Solution s;
	cout << s.reverseWords("God Ding");
}